package org.example.old.dto;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.annotation.write.style.*;
import com.alibaba.excel.enums.poi.FillPatternTypeEnum;
import com.alibaba.excel.metadata.data.CellData;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.example.old.converter.CustomStringConverter;

import java.util.Date;
import java.util.logging.SimpleFormatter;

@Data
@EqualsAndHashCode
@AllArgsConstructor
@NoArgsConstructor
//@ContentRowHeight(20)
//@HeadRowHeight(20)
//@ColumnWidth(25)
//// 头背景设置红色
//@HeadStyle(fillPatternType = FillPatternTypeEnum.SOLID_FOREGROUND,fillForegroundColor = 10)
//// 头字体设置18
//@HeadFontStyle(fontHeightInPoints = 18)
//// 内容的背景设置绿色
//@ContentStyle(fillPatternType = FillPatternTypeEnum.SOLID_FOREGROUND,fillForegroundColor = 17)
//// 内容字体设置16
//@ContentFontStyle(fontHeightInPoints = 16)
public class SysDto {
//    // 复杂表头
//    // 用户数据
//    // id   用户名称   用户编码  创建时间  创建人
//    @ExcelProperty({"用户数据","id"})
//    private int id;
//    @ExcelProperty({"用户数据","用户名称"})
//    private String userName;
//    @ExcelProperty({"用户数据","用户编码"})
//    private String userCode;
//    @ExcelProperty({"用户数据","创建时间"})
//    private String createDate;
//    @ExcelProperty({"用户数据","创建人"})
//    private String createUser;

//    @ExcelIgnore
//    @ExcelProperty("修改时间")
//    private String updateDate;



    // 复杂表头
    // 用户数据 id
    //         用户名称
    //         用户编码
    //         创建时间
    //         创建人
//    @ExcelProperty({"用户数据","用户数据"})
//    private int id;
//    @ExcelProperty({"id","用户数据"})
//    private int id;
//    @ExcelProperty({"用户名称","用户数据"})
//    private String userName;
//    @ExcelProperty({"用户编码","用户数据"})
//    private String userCode;
//    @ExcelProperty({"创建时间","用户数据"})
//    private String createDate;
//    @ExcelProperty({"创建人","用户数据"})
//    private String createUser;

//    // 字符串的头背景设置成粉红
//    @HeadStyle(fillPatternType = FillPatternTypeEnum.SOLID_FOREGROUND,fillForegroundColor = 14)
//    // 字符串的头字体设置18
//    @HeadFontStyle(fontHeightInPoints = 18)
//    // 字符串的内容的背景设置成天蓝
//    @ContentStyle(fillPatternType = FillPatternTypeEnum.SOLID_FOREGROUND,fillForegroundColor = 40)
//    // 字符串的内容字体设置成16
//    @ContentFontStyle(fontHeightInPoints = 16)
//    @ColumnWidth(5)
    /**
     * 强制读取第0个
     */
    @ExcelProperty(index = 0)
    private CellData<Integer> id;

//    @ExcelProperty("用户名称")
    @ExcelProperty(index = 1)
    private String userName;

//    @ColumnWidth(10)
//    @ExcelProperty("用户编码")
    @ExcelProperty(converter = CustomStringConverter.class)
    private String userCode;

//    @ContentLoopMerge(eachRow = 2)
    @DateTimeFormat("yyyy-MM-dd HH:mm:ss")
//    @ExcelProperty("创建时间标题很长日期标题很长日期标题很长很长")
    @ExcelProperty(index = 3)
    private String createDate;

//    @ColumnWidth(10)
//    @ExcelProperty("创建人")
    @ExcelProperty(index = 4)
    private String createUser;

//    @ExcelProperty("修改时间")
    @ExcelProperty(index = 5)
    private String updateDate;

//    @ColumnWidth(10)
//    @ExcelProperty("修改人")
    @ExcelProperty(index = 6)
    private String updateUser;

//    @ExcelProperty("备注")
    @ExcelProperty(index = 7)
    private String  remark;


    public SysDto(CellDataReadDemoData cellDataReadDemoData) {
        this.id = cellDataReadDemoData.getId();
        this.userName = String.valueOf(cellDataReadDemoData.getUserName());
        this.userCode = String.valueOf(cellDataReadDemoData.getUserCode());
        this.createDate = String.valueOf(cellDataReadDemoData.getDate());
        this.createUser = String.valueOf(cellDataReadDemoData.getCreateUser());
        this.updateDate = String.valueOf(cellDataReadDemoData.getDateDate());
        this.updateUser = String.valueOf(cellDataReadDemoData.getUpadteUser());
        this.remark = String.valueOf(cellDataReadDemoData.getRemark());
    }
}